package com.hdax.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdax.entity.Permission;
import com.hdax.entity.Role;
import com.hdax.dao.RoleMapper;
import com.hdax.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 角色表 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2021-03-22
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
    @Autowired
    private RoleMapper mapper;


    @Override
    public IPage<Role> selectPageVo(Page<Role> page, Role role) {
        return mapper.selectPageVo(page,role);
    }

    @Override
    public List<Role> selectRole() {
        return mapper.selectRole();
    }

    @Override
    public Role selectById(Integer id) {
        return mapper.selectRoleById(id);
    }

    @Override
    public int addRole(Role role) {
        return mapper.addRole(role);
    }

    @Override
    public int deleteRole(Integer id) {
        return mapper.deleteOneRole(id);
    }

    @Override
    public int updateRole(Role role) {
        return mapper.updateRole(role);
    }

    @Override
    public Integer findRoleIdByUserName(String account) {
        return mapper.findRoleIdByUserName(account);
    }
}
